feat: add Tavily as configurable search provider alongside Exa#8
Open
tavily-integrations wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Tavily as an additive, configurable search backend alongside the existing Exa integration. A
SEARCH_PROVIDERenv var ('exa'|'tavily', default'exa') controls which provider thesearch()function dispatches to. Exa remains fully intact as the default.Changes
src/app/api/deep-research/services.ts@tavily/coreimportgetTavily()) mirroring the existinggetExa()patterntavilySearch()wrapper that callstavily.search()withsearchDepth: "advanced"and maps results to the existingSearchResultshape ({title, url, content})src/app/api/deep-research/research-functions.tstavilySearchfrom servicessearch()to readSEARCH_PROVIDERenv var and branch: usestavilySearch()when'tavily', otherwise uses existing ExasearchAndContents()path.env.exampleTAVILY_API_KEYandSEARCH_PROVIDER=exaentriespackage.json@tavily/core(^0.7.3) dependencyDependency changes
@tavily/core^0.7.3 to dependenciesEnvironment variable changes
TAVILY_API_KEY— required whenSEARCH_PROVIDER=tavilySEARCH_PROVIDER— optional, defaults to'exa'; set to'tavily'to use TavilyNotes for reviewers
exa-js) andEXA_SEARCH_API_KEYare fully preservedSearchResulttype is already provider-agnostic, no type changes neededpage.tsx(unrelated image import) is unchangedAutomated Review
@tavily/coredependency is added topackage.json, lazy client initialization andtavilySearch()wrapper are implemented consistently with the existing Exa pattern inservices.ts, thesearch()function inresearch-functions.tscorrectly branches onSEARCH_PROVIDERenv var defaulting to"exa", and.env.exampledocuments both new variables. Exa functionality is fully preserved. The only notable issue is an unintendedpackage-lock.jsonbeing committed to a project that uses bun (abun.lockalready exists), which is a minor inconsistency and should be removed.